<template>
  <section v-loading="loading" class="cms-body">
    <div class="cms-list-header flex-between">
      <!-- 右操作 -->
      <div>
        <cms-input label="中文名" v-model="params.chineseName"></cms-input>
        <cms-input label="英文名" v-model="params.englishName"></cms-input>
        <el-button @click="goQuery()">查询</el-button>
      </div>
    </div>
    <!-- 表格 -->
    <el-table :data="tableData" stripe style="width: 100%" @selection-change="checkIds" @row-click="rowClick">
      <el-table-column prop="id" label="id" width="50" align="center"></el-table-column>
      <el-table-column prop="chineseName" label="中文名" align="center">
        <div slot-scope="scope" style="cursor: pointer">
          {{scope.row.chineseName}}
        </div>
      </el-table-column>
      <el-table-column prop="englishName" label="英文名" align="center"></el-table-column>
    </el-table>
    <!-- 表格底部 -->
    <div class="cms-list-footer">
      <div class="cms-left">
      </div>
      <!-- cms分页组件 -->
      <cms-pagination :total="total" @change="getPages"></cms-pagination>
    </div>
  </section>
</template>

<script>
  import listMixins from '@/mixins/list'

  export default {
    mixins: [listMixins],
    data() {
      return {
        params: {//只需要业务参数
          pageNo: 1,
          pageSize: 10,
          groupEditionType: 4,
          chineseName:'',
          englishName:''
        }
      };
    },
    methods: {
      rowClick(row, column, event) {
        row.typeName='频道组版';
        this.routerLink("/newsList", "list", row.id,row);
      },
      goQuery() {
        this.getTableData(this.params);
      },
      batchUpdate(url) { //保存排列循序
        let params = [];
        for (let i in this.checkedList) {
          let param = this.checkedList[i];
          console.log(param)
          param['keywordId'] = param.id;
          params.push(param)
        }
        params = JSON.stringify(params);
        this.$confirm('是否保存?', '提示', {type: "warning"}).then(mes => {
          this.$http.post(url, {params: params}).then(res => {
            if (res.code == "200") {
              this.successMessage('操作成功');
              this.getTableData(this.params);
            }
          });
        }).catch(error => {
          console.log(error)
        });
      }
    },
    created() {
      this.initTableData(this.$api.groupEditionPageList, this.params);
    }
  };
</script>

<style>
  .fontsizes{
    font-size: 13px;
    margin-bottom: 5px;
  }
</style>
